package com.minimalist.common.entity.basic.vo.operatorlog;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author 11987
 */
@Schema(name = "操作日志管理实体")
public class OperatorLogVO implements Serializable{

    @Schema(name = "operatorLogId", description = "操作日志id", type = "string")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long operatorLogId;

    @Schema(name = "name", description = "执行方法名称", type = "string")
    private String name;

    @Schema(name = "uri", description = "请求URI", type = "string")
    private String uri;

    @Schema(name = "method", description = "请求方式", type = "string")
    private String method;

    @Schema(name = "userAgent", description = "用户代理", type = "string")
    private String userAgent;

    @Schema(name = "ip", description = "请求IP", type = "string")
    private String ip;

    @Schema(name = "params", description = "请求参数", type = "string")
    private String params;

    @Schema(name = "requestTime", description = "请求时间", type = "string")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime requestTime;

    @Schema(name = "exceedTime", description = "请求时长(ms)", type = "string")
    private String exceedTime;

    @Schema(name = "result", description = "执行结果", type = "string")
    private String result;

    @Schema(name = "status", description = "状态  0：失败   1：成功", type = "string")
    private Integer status;

    @Schema(name = "creatorName", description = "操作人", type = "string")
    private String creatorName;
    
    @Schema(name = "createId", description = "创建人ID", type = "string")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createId;

    @Schema(name = "updateId", description = "更新人ID", type = "string")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long updateId;

    @Schema(name = "tenantId", description = "租户ID", type = "string")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long tenantId;

    public Long getOperatorLogId(){
        return operatorLogId;
    }

    public void setOperatorLogId(Long operatorLogId){
        this.operatorLogId = operatorLogId;
    }

    public String getName(){
        return name;
    }

    public void setName(String name){
        this.name = name;
    }

    public String getUri(){
        return uri;
    }

    public void setUri(String uri){
        this.uri = uri;
    }

    public String getMethod(){
        return method;
    }

    public void setMethod(String method){
        this.method = method;
    }

    public String getUserAgent(){
        return userAgent;
    }

    public void setUserAgent(String userAgent){
        this.userAgent = userAgent;
    }

    public String getIp(){
        return ip;
    }

    public void setIp(String ip){
        this.ip = ip;
    }

    public String getParams(){
        return params;
    }

    public void setParams(String params){
        this.params = params;
    }

    public LocalDateTime getRequestTime(){
        return requestTime;
    }

    public void setRequestTime(LocalDateTime requestTime){
        this.requestTime = requestTime;
    }

    public String getExceedTime(){
        return exceedTime;
    }

    public void setExceedTime(String exceedTime){
        this.exceedTime = exceedTime;
    }

    public String getResult(){
        return result;
    }

    public void setResult(String result){
        this.result = result;
    }

    public Integer getStatus(){
        return status;
    }

    public void setStatus(Integer status){
        this.status = status;
    }

    public String getCreatorName(){
        return creatorName;
    }

    public void setCreatorName(String creatorName){
        this.creatorName = creatorName;
    }

    public Long getCreateId(){
        return createId;
    }

    public void setCreateId(Long createId){
        this.createId = createId;
    }

    public Long getUpdateId(){
        return updateId;
    }

    public void setUpdateId(Long updateId){
        this.updateId = updateId;
    }

    public Long getTenantId(){
        return tenantId;
    }

    public void setTenantId(Long tenantId){
        this.tenantId = tenantId;
    }



    @Override
    public boolean equals(Object o){
        if (this == o){
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        OperatorLogVO that = (OperatorLogVO) o;
        return java.util.Objects.equals(operatorLogId, that.operatorLogId) &&
                java.util.Objects.equals(name, that.name) &&
                java.util.Objects.equals(uri, that.uri) &&
                java.util.Objects.equals(method, that.method) &&
                java.util.Objects.equals(userAgent, that.userAgent) &&
                java.util.Objects.equals(ip, that.ip) &&
                java.util.Objects.equals(params, that.params) &&
                java.util.Objects.equals(requestTime, that.requestTime) &&
                java.util.Objects.equals(exceedTime, that.exceedTime) &&
                java.util.Objects.equals(result, that.result) &&
                java.util.Objects.equals(status, that.status) &&
                java.util.Objects.equals(creatorName, that.creatorName) &&
                java.util.Objects.equals(createId, that.createId) &&
                java.util.Objects.equals(updateId, that.updateId) &&
                java.util.Objects.equals(tenantId, that.tenantId);
    }

    @Override
    public int hashCode(){
        return java.util.Objects.hash(operatorLogId, name, uri, method, userAgent, ip, params, requestTime, exceedTime, result, status, creatorName, createId, updateId, tenantId);
    }

    @Override
    public String toString(){
        return "OperatorLogVO{" +
                "operatorLogId=" + operatorLogId +
                ", name='" + name + '\'' +
                ", uri='" + uri + '\'' +
                ", method='" + method + '\'' +
                ", userAgent='" + userAgent + '\'' +
                ", ip='" + ip + '\'' +
                ", params='" + params + '\'' +
                ", requestTime=" + requestTime +
                ", exceedTime='" + exceedTime + '\'' +
                ", result='" + result + '\'' +
                ", status=" + status +
                ", creatorName='" + creatorName + '\'' +
                ", createId=" + createId +
                ", updateId=" + updateId +
                ", tenantId=" + tenantId +
                '}';
    }

}
